

<? $system_part = $_REQUEST ['sys_part']; ?>

<?
if(isset($_REQUEST['sys_part']))
{
    $system_part = $_REQUEST ['sys_part'];
}

if(isset($_REQUEST['nowpageid']))
{
    $nowpageid = $_REQUEST['nowpageid'];
}

if(isset($_REQUEST['sortby']))
{
    $sortby = $_REQUEST['sortby'];
}

if(isset($_REQUEST['term_nid']))
{
    $term_nid = $_REQUEST['term_nid'];
}

?>

<?php include_once("../../../common/common_setting_unit.php");         // 引入通用的设置文件 ?>
<?php include_once(ROOT_PATH_ . "/controller/common/module/head.php"); // 引入通用的头部 ?>
<?php include_once ("module/mod-nkeditor.php"); ?>
<?php include_once ("term-detail-function.php");?>

<?php 
update_exists('`'.$dbName.'`.`'.$table_Prefix."term`" , '`is_disabled`' , 2);//检查表是否有这个字段  如果没有自动生成
?>
<body>

<!--顶部栏-->
<div id="topbar"> <?php include ROOT_PATH_ . '/controller/common/module/topbar.php'; ?></div>

<!--容器-->
<div id="container" class="<? echo $now_extender ?>">

    <!--侧边栏-->
    <div id="sidebar"><?php include ROOT_PATH_ . '/controller/common/module/sidebar.php'; ?></div>





    <?
        //==============================================================================
        //这里开始才是平常开发需要注重的部分，其余的基本不用理会
        //==============================================================================
    ?>





    <div id="content" class="layui-form">

        <!--标题设定-->
        <?php $page_title="编辑店铺"?>
        <?php include ROOT_PATH_ . '/controller/common/module/mod-page-title.php'; ?>


<div class="detail-box <? echo $system_part ?> ">

<div class="detail-boxes term-detail-boxes layui-form">
<ul class="detail-boxing">
<form id="term_detail_form" method="post"  action="term-edit-function.php" enctype="multipart/form-data" name="uploadfile" class="  layui-form-pane">

            <input name="term_nid" type="hidden" value="<?php echo $term_nid?>" />
            <li class="mid"><label class="layui-form-label">人工编号：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_mid" size="20" value="<?php echo $term_mid?>"></div>
                <em class="explain">(填写您自己设置的编号，人工编号不作排序)</em></li>
             
            <li class="name">
                <label class="layui-form-label">店铺名称：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_name" size="20" value="<?php echo $term_name?>"></div>
                <em class="explain">(<u style="color:red">*必填项目</u>,填写本店铺的标题)</em>
            </li>
            
            <li class="en_name">
                 <label class="layui-form-label">英文店铺名称：</label>
                 <div class="layui-input-block"><input type="text" class="layui-input" name="term_en_name" size="20" value="<?php echo $term_en_name?>"></div>
                 
            </li>
            

            
              <?php 
	$sql = "select count(*) as brand_count from ".$table_Prefix."term  where publish = 1 and belong = 'brand' ";
			
	$brand_res = mysql_query($sql);
			
	$brand_count = mysql_fetch_assoc($brand_res);	
	
?>
            <div class="term layui-form-item detail">
                <label class="layui-form-label">所属品牌： </label>
                <div class="layui-input-block">
                      <?php 
						if($brand_count['brand_count'] == 0){
						?>
                            <a href="/controller/extender/brand/view/term-add.php?sys_part=brand" class="threeDbtn layui-btn ">添加品牌</a>
                      <?php
						}
						else{
						?>
                      <div style="float:left;">
                    <? include("mod-brand-select.php");?>
                  </div>

                      <?php 
						}
						?>
                    </div>

                <em class="explain">(选择对应的品牌，可多选。)</em>

              </div>      
              
            
            <li class="introduce"><label class="layui-form-label">店铺简介：</label>
              <div class="layui-input-block"><textarea name="term_introduce" cols="20"><? echo $term_introduce ?></textarea></div>
                <em class="explain">(填写本店铺的店铺概述文字)</em>
            </li>
            
            <li class="icon"><label class="layui-form-label">ICON图片：</label>
                <img src="/uploadfiles/<?echo $theme_folder?>/<? echo $term_icon ?>" width="100"/> <a href="term-delete-img.php?nid=<?php echo $trans_nid ?>&&img=icon"> 删除</a><span class="title-data">(请上传像素<? echo $first_icon_data[0]?>X<? echo $first_icon_data[1]?>的图片,格式为jpeg)</span></li>
            <li class="icon"><label class="layui-form-label">上传文件：</label>
    <div class="layui-input-block"><input type="file" name="icon"  onchange="fileChange(this);"/></div>
                <em class="explain">(上传本店铺的列表图标)</em></li>
            
            <li class="banner"><label class="layui-form-label">横幅图片：</label>
                <img src="/uploadfiles/<?echo $theme_folder?>/<? echo $term_term_banner ?>" width="100"/> <a href="term-delete-img.php?nid=<?php echo $trans_nid ?>&&img=banner"> 删除</a><span class="title-data">(请上传像素<? echo $first_banner_data[0]?>X<? echo $first_banner_data[1]?>的图片,格式为jpeg)</span></li>
            <li class="banner"><label class="layui-form-label">上传文件：</label>
    <div class="layui-input-block"><input type="file" name="banner"  onchange="fileChange(this);"/></div>
                <em class="explain">(上传本店铺的横幅Banner图片)</em></li>
                
                 <li class="banner"><label class="layui-form-label">横幅标题：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_banner_title" value="<?php echo $term_info['banner_title']?>"></div>
                <em class="explain">(填写横幅标题内容)</em></li>
                
                             <li class="banner"><label class="layui-form-label">横幅链接：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_banner_url" value="<?php echo $term_info['banner_url']?>"></div>
                <em class="explain">(填写横幅链接内容)</em></li>

            <li class="extend_img"><label class="layui-form-label">备用图片：</label><img src="../../uploadfiles/<?echo $theme_folder?>/<? echo $term_term_extend_img ?>" width="100"/> <a href="term-delete-img.php?nid=<?php echo $trans_nid ?>&&img=extend_img"> 删除</a><span class="title-data">(请上传像素<? echo $first_extend_img_data[0]?>X<? echo $first_extend_img_data[1]?>的图片,格式为jpeg)</span></li>
            <li class="extend_img"><label class="layui-form-label">上传文件：</label>
    <div class="layui-input-block"><input type="file" name="extend_img"  onchange="fileChange(this);"/></div>
                <em class="explain">(上传本店铺的备用图片)</em></li>





            <li class="title"><label class="layui-form-label">网页用标题：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_title" size="20" value="<? echo $term_title ?>"></div>
                <em class="explain">(填写浏览器标签页显示的本店铺页名称)</em></li>
			<li class="description"><label class="layui-form-label">网页用描述：</label><div class="layui-input-block"><textarea name="term_description"><? echo $term_description ?></textarea></div>
                <em class="explain">(填写本店铺页描述性文字，用于搜索引擎的搜索结果显示)</em></li>
            <li class="keyword"><label class="layui-form-label">网页用关键词：</label><div class="layui-input-block"><textarea name="term_keyword"><? echo $term_keyword ?></textarea></div>
                <em class="explain">(填写本店铺页的关键词，利于搜索引擎抓取)</em></li>
            <li class="url"><label class="layui-form-label">网页地址：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_url" size="20" value="<? echo $term_url ?>"></div>
                <em class="explain">(填写本店铺页前台网址，用于伪静态设置，利于搜索引擎抓取)</em></li>

            <br />
            
             
                         <li class="detail">
 <label class="layui-form-label">店铺详情：</label>
<div class="layui-input-block"><textarea name="term_detail" style="width:800px;height:400px;visibility:hidden;"><? echo $term_detail ?>
</textarea></div>
                <em class="explain">(填写本店铺前台显示的详细文字介绍，默认留空)</em>
</li>


 

            <li class="listorder"><label class="layui-form-label">列表排序：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_listorder" size="20" value="<? echo $term_listorder ?>" onkeydown="onlyNum();" onfocus="checkdefault(term_listorder)" onblur="checkempty(term_listorder)"></div>
                <em class="explain">(填写本店铺在所属前台列表下的列表排序，数字越大，排序越靠前)</em></li>
        
         
            <li class="hotsale"><label class="layui-form-label">热销店铺：</label>
         		
                <div class="layui-input-block">
                    <input name='term_hotsale' type='radio' value='1'  title="标记热销" <?if($term_hotsale == '1'){echo "checked='checked'";}?>/>
                    <input name='term_hotsale' type='radio' value='0'  title="取消热销" <?if($term_hotsale == '0'){echo "checked='checked'";}?>/>
                </div>
           
                <em class="explain">(可标记热销店铺，将在前台添加热销店铺标识或显示热销产品店铺)</em>
             </li>
             

            
             <li class="recommend"><label class="layui-form-label">推荐状态：</label>
             	
                 <div class="layui-input-block">
                    <input name='term_recommend' type='radio' value='1'  title="推荐店铺" <?if($term_recommend == '1'){echo "checked='checked'";}?>/>
                    <input name='term_recommend' type='radio' value='0'  title="取消推荐" <?if($term_recommend == '0'){echo "checked='checked'";}?>/>
                </div>
          
                <em class="explain">(可标记推荐店铺，将在前台添加推荐店铺标识或显示推荐产品店铺)</em>
             </li>
             
             
             <li class="link"><label class="layui-form-label">链接地址：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_link" size="20" value="<? echo $term_link ?>"></div>
                <em class="explain">(填写用于前台直接跳转的文章链接，类似于转载文章，默认留空)</em></li>
             
             
               
            <li class="mark"><label class="layui-form-label">标记状态：</label>
            
            	<div class="layui-input-block">
                    <input name='term_mark' type='radio' value='1'  title="添加标记" <?if($term_mark == '1'){echo "checked='checked'";}?>/>
                    <input name='term_mark' type='radio' value='0'  title="取消标记" <?if($term_mark == '0'){echo "checked='checked'";}?>/>
                </div>
           
                <em class="explain">(选择添加标记，以上信息将在前台显示；选择取消标记，以上信息不在前台显示)</em>
             </li>




            <li class="vip"><label class="layui-form-label">权限设置：</label>
            	
                <div class="layui-input-block">
                    <input name='term_vip' type='radio' value='0'  title="游客可见" <?if($term_vip == '0'){echo "checked='checked'";}?>/>
                    <input name='term_vip' type='radio' value='1'  title="vip1可见" <?if($term_vip == '1'){echo "checked='checked'";}?>/>
                    <input name='term_vip' type='radio' value='2'  title="vip2可见" <?if($term_vip == '2'){echo "checked='checked'";}?>/>
                </div>
                
              
                <em class="explain">(设置会员可浏览的权限)</em>
            </li>
             
             
             
             
             <li class="markorder"><label class="layui-form-label">标记排序：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_markorder" size="20" value="<? echo $term_markorder ?>" onkeydown="onlyNum();" onfocus="checkdefault(term_markorder)" onblur="checkempty(term_markorder)"></div>
                <em class="explain">(填写店铺在前台列表中的排序，数字越大，排序越靠前)</em></li>
  
            <li class="clickrate"><label class="layui-form-label">点击次数：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_clickrate" size="20" value="<? echo $term_clickrate ?>" onkeydown="onlyNum();" onfocus="checkdefault(term_clickrate)" onblur="checkempty(term_clickrate)"></div>
                <em class="explain">(显示此店铺在前台被浏览点击的次数，亦可在由后台管理员自行设置数量)</em></li>
            
			
			<li class="modifytime"><label class="layui-form-label">修改时间：</label>
    <div class="layui-input-block"><input type="text" class="layui-input"  name="term_modifytime" size="20" value="<? echo date("Y-m-d H:i:s") ?>" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" class="laydate-icon" ></div>
                <em class="explain">(填写店铺修改时间)</em></li>
 
             <li class="publish"><label class="layui-form-label">发布状态：</label>
             
             	<div class="layui-input-block">
                    <input name='term_publish' type='radio' value='1'  title="立即发布" <?if($term_publish == '1'){echo "checked='checked'";}?>/>
                    <input name='term_publish' type='radio' value='0'  title="暂未发布" <?if($term_publish == '0'){echo "checked='checked'";}?>/>
                </div>
           
                <em class="explain">(选择立即发布，以上信息才能在前台显示；选择暂未发布，只对以上信息进行保存，不在前台显示)</em>
    
             </li>
			 
          
          <li class="layui-form-item is_disabled">
            <label class="layui-form-label">禁止删除：</label>
    
            <div class="layui-input-block">
                    <input name='term_is_disabled' type='radio' value='1'  title="禁止删除" <?if($term_is_disabled == '1'){echo "checked='checked'";}?>/>
                    <input name='term_is_disabled' type='radio' value='0'  title="允许删除" <?if($term_is_disabled == '0'){echo "checked='checked'";}?>/>
                </div>
                <em class="explain">(如标记了禁止删除，列表页下面不能删除当前信息)</em>
    
         </li>   
             <input name="term_interm" type="hidden" value="<? echo $term_interm ?>" />
             <input name="sys_part" type="hidden" value="<? echo $system_part ?>" />
             <input name="nowpageid" type="hidden" value="<? echo $_REQUEST['nowpageid'] ?>" />
             <input name="sortby" type="hidden" value="<? echo $_REQUEST['sortby'] ?>" />
             
             <input type="hidden" name="brand_list_json" id="brand_list_json" />
             
        <div class="function">
            <button class="layui-btn "  lay-submit type="button" lay-filter="formSub">立即提交</button>
            <input type="reset" class="layui-btn" value="重置"/>
        </div>
</form>
</ul>
</div>
</div>

<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat" />
</div>
<!--container端點01-->
</div>

<script type="text/javascript">
$(document).ready(function(e) {
    

  
 layui.use(['transfer', 'layer', 'util', 'form', 'tree'], function(){
	  var $ = layui.$
	  ,transfer = layui.transfer
	  ,layer = layui.layer
	  ,util = layui.util
	  ,tree = layui.tree
	  ,form = layui.form;
	   
	
						
	  form.on('submit(formSub)', function(data){
		
		 
		 if($('#brand_list').length > 0){
		 	 var checkbrandData = tree.getChecked('brand_list');
			 $('#brand_list_json').val(JSON.stringify(checkbrandData))
		 }
			$('.layui-form-pane').submit()
	  })
	  
	});

  
});

</script>
<?php include  ROOT_PATH_."/controller/modules/footer.php"; ?>
</body>
</html>
